//
//  ShareViewController.m
//  ShareYOU
//
//  Created by 杨亭 on 14-12-17.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "ShareViewController.h"
#import "NewShareViewController.h"
#import "ShareCell.h"

@interface ShareViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, retain) NSMutableArray *arr;
@property (nonatomic, retain) UITableView *tableView;

@end

@implementation ShareViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    //创建分享页面导航栏右边的推出以前分享页面的图标
    UIImage *imageRight = [UIImage imageNamed:@"shareModule_shareAdd.png"];
    self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithImage:imageRight style:UIBarButtonItemStylePlain target:self action:@selector(sharePageAction:)] autorelease];
    
    //创建tableView
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 375, 667)];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.view addSubview:self.tableView];
    [_tableView release];


    
//    //现在的时间
//    NSDate *date = [NSDate date];
//    NSLog(@"date%@", date);
//    
//    NSDate *lateDate = [[NSDate alloc] init];
//    NSLog(@"lateDate%@", lateDate);

//    //判断时间是哪一天
//    NSDate *randomDate = [NSDate dateWithTimeIntervalSinceNow:-182338];
//    NSTimeInterval resultTime = [[NSDate date] timeIntervalSinceDate:randomDate];
//
//    //日期的字符串
//    NSString *dateStr = @"2014-12-18 9:21:3";
//    //转换
//    NSDate *formatDate = [formatter dateFromString:dateStr];
//    NSLog(@"%@", formatDate);
//    
//    NSString *strDate = [formatter stringFromDate:date];
//    NSLog(@"%@", strDate);
    
//    NSDateFormatter *dateFormatter=[[NSDateFormatter alloc]init];
//    [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
//    NSString *dateString = [dateFormatter stringFromDate:[NSDate date]];
//    NSLog (@"today is %@", dateString);
//    
//    
//    
//    if (resultTime < 20 * 60 * 60) {
//        NSLog(@"昨天");
//        self.share.shareTimeLabel.text = @"昨天";
//    }else if (resultTime > 24 * 60 * 60 && resultTime < 2 * 24 * 60 * 60)
//    {
//        NSLog(@"前天");
//        self.share.shareTimeLabel.text = @"前天";
//    }
//    else{
//        NSLog(@"%@", randomDate);
//
//        self.share.shareTimeLabel.text = @"%@", randomDate;
//    }
//    
//
//    NSDate *today = [NSDate dateWithString:@"2009-12-11 00:00:00 +0000"];
//    NSDate *yesterday = [NSDate dateWithString:@"2009-12-10 00:00:00 +0000"];
//    

    
    
    
    
    
    
    
    
    
    
    
}

//高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 260;
}




- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 10;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *str = @"a";
    ShareCell *cell = [tableView dequeueReusableCellWithIdentifier:str];
    if (cell == nil) {
        cell = [[[ShareCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:str] autorelease];
    }
    
    
    
    
    
    return cell;
    
}

//点击cell
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    //点击后恢复原状
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    
}













//导航栏右边分享图标方法实现
- (void)sharePageAction:(UIBarButtonItem *)item
{
    //推出创建新的分享页面
    NewShareViewController *shareVC = [[NewShareViewController alloc] init];
    [self.navigationController pushViewController:shareVC animated:YES];
    
}




- (void)dealloc
{
    [_arr release];
    [_tableView release];
    [super dealloc];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
